//
//  ZJMyLotteryController.m
//  Lottery
//
//  Created by ZJ on 2018/8/15.
//  Copyright © 2018年 iCatch Technology Inc. All rights reserved.
//

#import "ZJMyLotteryController.h"
#import "ZJSettingController.h"
#import "ZJHelpController.h"

@interface ZJMyLotteryController ()

@property (weak, nonatomic) IBOutlet UIButton *loginButton;

@end

@implementation ZJMyLotteryController

// 跳转到 设置界面
- (IBAction)settingClick:(id)sender {
    // 跳转到设置
    ZJSettingController *setting = [[ZJSettingController alloc] init];
    // 传入 plist 名字
    setting.plistName = @"Setting";
    
    // 设置 常见问题 按钮
    UIBarButtonItem *helpItem = [[UIBarButtonItem alloc] initWithTitle:@"常见问题" style:UIBarButtonItemStylePlain target:self action:@selector(helpClick)];
    setting.navigationItem.rightBarButtonItem = helpItem;
    
    // 设置标题
    setting.navigationItem.title = @"设置";
    
    [self.navigationController pushViewController:setting animated:YES];
}

// 点击 常见问题 事件
- (void)helpClick {
    ZJHelpController *vc = [[ZJHelpController alloc] init];
    
    // 跳转到 常见问题的 tableViewController
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // 获取图片
    UIImage *image = [UIImage imageNamed:@"RedButton"];
    
    // 中间1像素拉伸
    image = [image stretchableImageWithLeftCapWidth:image.size.width * 0.5 topCapHeight:image.size.height * 0.5];
    // 设置按钮的背景图片
    [self.loginButton setBackgroundImage:image forState:UIControlStateNormal];
    
    // 获取图片
    UIImage *imagePress = [UIImage imageNamed:@"RedButtonPressed"];
    
    // 中间1像素拉伸
    imagePress = [imagePress stretchableImageWithLeftCapWidth:imagePress.size.width * 0.5 topCapHeight:imagePress.size.height * 0.5];
    // 设置按钮的背景图片
    [self.loginButton setBackgroundImage:imagePress forState:UIControlStateHighlighted];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
